package com.emokili.ewa.core.frame.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.emokili.ewa.core.frame.dao.MemberFrameDao;
import com.emokili.ewa.core.frame.dao.PlayListImageDao;
import com.emokili.ewa.core.frame.entity.MemberFrameEntity;
import com.emokili.ewa.core.frame.entity.PlayListImageEntity;
import com.emokili.ewa.core.frame.service.MemberFrameService;
import com.emokili.ewa.core.frame.service.PlayListImageService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PlayListImageServiceImpl extends ServiceImpl<PlayListImageDao, PlayListImageEntity> implements PlayListImageService {

    @Override
    public List<PlayListImageEntity> listImages(String playlistId) {
        List<PlayListImageEntity> playListImageEntities = list(new QueryWrapper<PlayListImageEntity>().eq("play_list_id", playlistId));
        return playListImageEntities;
    }

    @Override
    public void favorite(String imageId,String favorite) {
        PlayListImageEntity byId = getById(imageId);
        byId.setFavorite(favorite);
        saveOrUpdate(byId);
    }
}
